' PCM to MP3 Conversion Script
' Usage: Double click to run, or call from command line

Option Explicit

' Define variables
Dim objShell, ffmpegPath, pcmFile, mp3File, command

' Create Shell object
Set objShell = CreateObject("WScript.Shell")

' Set FFmpeg path (modify according to your actual path)
ffmpegPath = "ffmpeg.exe"

' Set input and output file paths (modify according to your actual paths)
pcmFile = "output.pcm"
mp3File = "output.mp3"

' Build FFmpeg command
command = """" & ffmpegPath & """ -f s16le -ar 16000 -ac 1 -i """ & pcmFile & """ """ & mp3File & """"

' Display the command to be executed
WScript.Echo "Executing command: " & command
WScript.Echo ""

' Execute command
Dim exitCode
exitCode = objShell.Run(command, 1, True)

' Check execution result
If exitCode = 0 Then
    WScript.Echo "Conversion successful! Output file: " & mp3File
Else
    WScript.Echo "Conversion failed! Exit code: " & exitCode
End If

' Clean up object
Set objShell = Nothing

' Show completion message
WScript.Echo ""
WScript.Echo "Conversion completed!"
MsgBox "Conversion completed!", 64, "PCM to MP3" 